agora.io GetAudioMixingDuration always return -7 - unity3d

After I updated the voice SDK for Unity to 3.6.1 (previously 2.4) I tried to add the new parameter "filePath" at GetAudioMixingDuration instead of using the usual method with no parameters. For some reason, the same file played and then called GetAudioMixingDuration(), in the new method with the "filePath" parameter always returns -7.
What I did is to point to the very same path of the file in the "filePath" parameter instead of playing it and then call the no parameter method, but for some reason, it's not working.
I also tried both relative and absolute paths, point a file inside and outside the Asset folder, and check if Agora is connected to a channel.
I really don't know what is wrong and the documentation doesn't help at all.

This API is deprecated. Please check the code header for its documentation, especially look for the comment about Android if that's what you are running on. Quoted here:
/**
* Gets the total duration of the music file.
*
* #deprecated Deprecated from v3.6.1.1. Use {#link agora_gaming_rtc.IRtcEngine.GetAudioFileInfo GetAudioFileInfo} instead.
*
* #note Call this method after joining a channel.
*
* #param filePath The absolute path (including the filename extensions) of
* the local music file. For example: `C:\music\audio.mp4`. Supported audio
* formats include MP3, AAC, M4A, MP4, WAV, and 3GP. For more information,
* see [Supported Media Formats in Media Foundation](https://learn.microsoft.com/en-us/windows/win32/medfound/supported-media-formats-in-media-foundation).
* When you access a local file on Android, Agora recommends passing a
* URI address or the path starts with `/assets/` in this parameter.
*
* #return
* - ≥ 0: A successful method call. Returns the total duration (ms)
* of the specified music file.
* - < 0: Failure.
*/
public int GetAudioMixingDuration(string filePath)

Related

Flutter on VS Code issue: StreamController.Sink.add() suddenly require argument PUSH

Good afternoon good people,
I'm suddenly experiencing a problem with VS Code:
in a couple of Flutter apps Streamcontroller.sink.add();
suddenly require the argument "push" (before it didn't).
without adding the push argument obviously it return the error
2 required argument(s) expected, but 1 found.dart(not_enough_required_arguments)
Does anyone know what might have happened?
thank you in advance for your help
Francesco
edit: via f12 the definition actually shows the argument push
part of dart.core;
/**
* A generic destination for data.
*
* Multiple data values can be put into a sink, and when no more data is
* available, the sink should be closed.
*
* This is a generic interface that other data receivers can implement.
*/
abstract class Sink<T> {
/**
* Adds [data] to the sink.
*
* Must not be called after a call to [close].
*/
void add(T data, Future push);
/**
* Closes the sink.
*
* The [add] method must not be called after this method.
*
* Calling this method more than once is allowed, but does nothing.
*/
void close();
}
but as pskink reminded the documentation doesn't show this requirement;
I don't have idea how this can have changed,
at this point the question is:
how do I restore it to normality?
TL;DR
what appeared to be bad code,
was instead corrupted dart code;
I followed the instruction provide by Gunter
and everything went back to normal.
Thanks again Gunter

What is difference between waitForAngularEnabled and browser.ignoreSynchronization in protractor?

What is browser.ignoreSynchronization?
/**
* If true, Protractor will not attempt to synchronize with the page before
* performing actions. This can be harmful because Protractor will not wait
* until $timeouts and $http calls have been processed, which can cause
* tests to become flaky. This should be used only when necessary, such as
* when a page continuously polls an API using $timeout.
*
* #type {boolean}
*/
&
waitForAngularEnabled
Both looks same. Is there any specific thing that can achieve by one and not by other?
They are the exact same, if you look at the source code ignoreSynchronization actually calls waitForAngularEnabled. The only thing to note is, ignoreSynchronization is being deprecated and eventually will no longer be available. They are switching to waitForAngularEnabled as the main property.
As far as what they do, that has been answered here in good detail.

HM-10 Wont accept name and returning +NAME=?

Maybe someone had this problem.
"Send(AT)"
OK
"Send(AT+NAME?)"
+NAME=?
OK
"Send(AT+NAME1234)"
+NAME=1234
OK
"Send(AT+NAME?)"
+NAME=?
OK
Cant get this BLE HM-10 to remember name.
I was using FTDI and ch340, arduino monitor and realterm
Update!
After reset to defaults it started working Now i now its a genuine HM-10 and i have CC41-A
Command Description *
---------------------------------------------------------------- *
AT Check if the command terminal work normally *
AT+RESET Software reboot *
AT+VERSION Get firmware, bluetooth, HCI and LMP version *
AT+HELP List all the commands *
AT+NAME Get/Set local device name *
AT+PIN Get/Set pin code for pairing *
AT+PASS Get/Set pin code for pairing *
AT+BAUD Get/Set baud rate *
AT+LADDR Get local bluetooth address *
AT+ADDR Get local bluetooth address *
AT+DEFAULT Restore factory default *
AT+RENEW Restore factory default *
AT+STATE Get current state *
AT+PWRM Get/Set power on mode(low power) *
AT+POWE Get/Set RF transmit power *
AT+SLEEP Sleep mode *
AT+ROLE Get/Set current role. *
AT+PARI Get/Set UART parity bit. *
AT+STOP Get/Set UART stop bit. *
AT+START System start working. *
AT+IMME System wait for command when power on. *
AT+IBEA Switch iBeacon mode. *
AT+IBE0 Set iBeacon UUID 0. *
AT+IBE1 Set iBeacon UUID 1. *
AT+IBE2 Set iBeacon UUID 2. *
AT+IBE3 Set iBeacon UUID 3. *
AT+MARJ Set iBeacon MARJ . *
AT+MINO Set iBeacon MINO . *
AT+MEA Set iBeacon MEA . *
AT+NOTI Notify connection event . *
AT+UUID Get/Set system SERVER_UUID . *
AT+CHAR Get/Set system CHAR_UUID . *
-----------------------------------------------------------------*
Note: (M) = The command support slave mode only. *
For more information, please visit http://www.bolutek.com *
Copyright#2013 www.bolutek.com. All rights reserved. *
+VERSION=Firmware V3.0.6,Bluetooth V4.0 LE
Type to get value (Same is with other commands):
AT+NAME
Type to set value:
AT+NAMEnewName
You can try equal sign for set a value
AT+NAME=newName
edit for code prefix
try a shorter name. I had the same problem.some version do not accept long name

how to retrieve bus pointer from device tree

Question:
I'm trying to find a way to retrieve the dev object for an mdio_bus that has been added to the device tree. I'm sure I'm going to be rapidly applying my palm to my forehead when I get past this, but for the life of me, I can't find the answer anywhere. I've seen how to find objects on the bus itself using bus_find_device_by_name(), but I can't seem to find how to get the bus itself.
Background:
We are providing network access to our host using a Micrel KSZ8863 Ethernet switch attached to the MACB on an at919g20. Rather than using the fixed PHY option, I've spoofed MDIO address 0 to be a "fake" PHY representing the fixed MII link to the switch. I'm writing a driver for the switch to receive its interrupts and monitor the outward facing PHYs and control the link state of the "fake" PHY to the host. In order to configure the switch beyond basic MIIM configuration, you need to use SMI on the MDIO bus to access the full array of registers in the switch. Through further tweaking of the mii_read/write functions in the MACB, adding a header to the reg address, I believe I can use the MACB's MDIO/MII controller to do the right thing for SMI requests. Because the bus no longer gets addressed by PHY:REG, I need to be able to issue raw read/write commands straight to the bus from the switch driver. And that brings me back to my question: How do I request the dev object of the mdio_bus from the device tree by name?
Thanks,
Brian
After hunting around, fruitlessly, for a way to retrieve a device pointer to an mii_bus object, I ended up coming up with the following solution. I'm not sure its the best way to go about it, but it seems pretty clean. I basically ended up adding a helper function to mdio_bus.c that allows another driver to search for a bus by name using class_find_device(). I'm sure there is better way to do this, that doesn't involve adding onto the bus' driver, but it doesn't seem like the worst way either.
-Brian
Here are the functions I added to mdio_bus.c:
/**
* mdiobus_match_name - compares specified string to the device name
* #dev: device object to be examined
* #data: pointer to string to compare device name to
*
* Description: matching function used in call to class_find_device() to find
* a device with the specified name
*/
static int mdiobus_match_name( struct device * dev, void * data )
{
const char * name = data;
return sysfs_streq( name, dev_name( dev ) );
}
/**
* mdiobus_find_by_name - Convenience function for retrieving an mii_bus pointer
* by name
* #name: name of the bus being searched for
*/
struct mii_bus * mdiobus_find_by_name( char * name )
{
struct device * dev;
/* search devices registered for with the mdio_bus_class using the device
name as the matching criteria */
dev = class_find_device( &mdio_bus_class,
NULL,
(void *)name,
mdiobus_match_name );
/* return the mii_bus pointer or NULL if none was found */
return dev ? container_of( dev, struct mii_bus, dev ) : NULL;
}
EXPORT_SYMBOL( mdiobus_find_by_name );

TTURLCache to cache my image and data

I used three20's photo gallery in my app and it worked really well and looked neat and pretty. And basically I don't need to worry about all the fetch-photos-from-the-server thing since three20 has fetched and managed and cached the data for me, all of which are done behind the scene.
That's when I started to notice this magic caching mechanism implemented in three20, called TTURLCache. In its header file I find the following interface methods:
/**
* Stores a data on disk.
*/
- (void)storeData:(NSData*)data forURL:(NSString*)URL; //method 1
- (void)storeData:(NSData*)data forKey:(NSString*)key;
/**
* Stores an image in the memory cache.
*/
- (void)storeImage:(UIImage*)image forURL:(NSString*)URL; //method 2
/**
* Stores an etag value in the etag cache.
*/
- (void)storeEtag:(NSString*)etag forKey:(NSString*)key; //method 3
My questions:
Method 1 and method 2 in the above code: are they only capable of storing data, or are they capable of both fetching and storing?
What is an etag in method 3?
Method 1 says it will store the data on disk, while method 2 says it will store the image in memory. If I use method 2 to store an image, will it get lost once I kill and restart my app?
Thanks a lot in advance.
Those are the storage methods. The retrieval methods are separate. (See below.)
Etags are a way to optimize network traffic. See Wikipedia for a good intro.
I think that Three20 both stores the image file on disk, and the decoded image itself in memory. Certainly, any in-memory caches would be cleared if the app re-started, but remember that under iOS 4, that probably happens less often that you think.
To get data out of the cache, try one of:
/**
* Gets the data for a URL from the cache if it exists and is newer than a minimum timestamp.
*
* #return nil if hthe URL is not cached or if the cache entry is older than the minimum.
*/
- (NSData*)dataForURL:(NSString*)URL expires:(NSTimeInterval)expirationAge
timestamp:(NSDate**)timestamp;
- (NSData*)dataForKey:(NSString*)key expires:(NSTimeInterval)expirationAge
timestamp:(NSDate**)timestamp;
/**
* Gets an image from the in-memory image cache.
*
* #return nil if the URL is not cached.
*/
- (id)imageForURL:(NSString*)URL;
- (id)imageForURL:(NSString*)URL fromDisk:(BOOL)fromDisk;
I would advise reading through the source, though. If memory serves, TTURLCache isn't all that big a class.